package com.mcxx.modules.system.service.read;

import com.mcxx.modules.system.dao.read.PolicyReadDao;
import com.mcxx.modules.system.dto.PolicyDTO;
import com.mcxx.modules.system.entity.PolicyEntity;
import com.mcxx.modules.system.param.PolicyParam;
import com.yinhai.ta404.core.restservice.requestbean.PageParam;
import com.yinhai.ta404.core.restservice.resultbean.Page;
import com.yinhai.ta404.core.service.BaseService;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.ParseException;
import java.util.List;


@Service("commonPolicyReadService")
@TaTransactional(readOnly = true)
public class PolicyReadService extends BaseService {

    @Autowired
    private PolicyReadDao commonPolicyReadDao;


    public Page findPage(PolicyParam param, PageParam pageParam) {
        commonPolicyReadDao.beginPager(pageParam);
        List<PolicyDTO> list = commonPolicyReadDao.getPolicyList(param);
        return commonPolicyReadDao.endPager(list);
    }


    public PolicyEntity getById(String id) {
        return commonPolicyReadDao.getByPolicyId(id);
    }
}
